import { actions } from "../../http/actions";
import HCMqttBaseService from "../BaseService";
import { hc } from "../../hc";

export default class HCMQTTRecordService extends HCMqttBaseService {

	/**
	 * 手动推送认证记录
	 *
	 * @param {string} topic
	 * @param {hc.mqtt.deviceId} deviceId
	 * @param {string} start 手推开始时间 eg:yyyy-MM-ddThh:mm:ss
	 * @param {string} end 手推结束时间 eg:yyyy-MM-ddThh:mm:ss
	 * @return {*}
	 * @memberof HCMQTTRecordService
	 */
	async manualPushRecord(topic: string, deviceId: hc.mqtt.deviceId, start: string, end: string) {
		const operator = actions.ManualPushRecords;
		const data = {
			operator,
			info: {
				facesluiceId: deviceId,
				start,
				end,
			},
		};
		const client = this.getMQTTClient();
		const res = await client.fetch<hc.mqtt.manualPushAck>(topic, data);
		return res;
	}
}
